package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 活动计划
 *
 * @author ytche
 *
 */
@Entity
@Table(name = "tnb_activity_plan")
@JsonApiResource(type = "activityPlan")
public class ActivityPlan extends BaseEntity {

	private static final long serialVersionUID = 1L;
	private String time;
	private Dicttype day;
	private Activity activity;
	private String place;
	private String picPath;
	private String description;

	@Column(name = "time")
	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "day", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getDay() {
		return day;
	}

	public void setDay(Dicttype day) {
		this.day = day;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "act_id", foreignKey = @ForeignKey(name = "null"))
	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}

	@Column(name = "place")
	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	@Column(name = "pic_path")
	public String getPicPath() {
		return picPath;
	}

	public void setPicPath(String picPath) {
		this.picPath = picPath;
	}

	@Column(name = "description")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
